package codingforgreat.lchot150;

public class Lc012 {
    public String intToRoman(int num) {
        String[][] help = new String[][]{
                {"","I","II","III","IV","V","VI","VII","VIII","IX"},
                {"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"},
                {"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"},
                {"","M","MM","MMM"}
        };
        StringBuilder sb = new StringBuilder();
        sb.append(help[3][num/1000 % 10])
                .append(help[2][num/100 % 10])
                .append(help[1][num/10 % 10])
                .append(help[0][num%10]);
        return sb.toString();
    }
}
